package com.spring.config.system.config;

import org.springframework.cache.CacheManager;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
import org.springframework.context.annotation.*;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

/**
 * ClassName: SpringConfig
 * Description:
 * Date: 2017/5/8 19:40
 *
 * @author SAM SHO
 * @version V1.0
 */
@Configuration
@PropertySource(value = "classpath:spring.properties")
@ComponentScan(basePackages = "com.spring.config")
@EnableAspectJAutoProxy(proxyTargetClass = true)
@EnableScheduling
public class SpringConfig {

    /**
     * 使用@Value()需要配置这个Bean
     *
     * @return
     */
    @Bean
    public PropertySourcesPlaceholderConfigurer propertyConfigurer() {
        return new PropertySourcesPlaceholderConfigurer();
    }

    @Bean
    public CacheManager cacheManager() {
        return new ConcurrentMapCacheManager("users");
    }


}
